package tpoo.common.utils.passiveOperations;


import java.io.Serializable;
import java.util.List;

import tpoo.common.dto.model.ObjectID;
import tpoo.common.dto.model.users.UserDTO;
import tpoo.common.utils.Parameters;
import tpoo.common.utils.UserSession;


public class MessageReceivedOperation extends PassiveOperation {


	private ObjectID userID;
	private String message;

	public MessageReceivedOperation(String message, ObjectID userID) {
		this.setMessage(message);
		this.setUserID(userID);
		this.
			addParameter(message).
			addParameter(userID);
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getMessage() {
		return message;
	}


	@Override
	public void execute() throws Exception {
		UserDTO user = UserSession.getInstance().getUser();
		user.receive(this.getMessage(), this.getUserID());
	}

	public void setUserID(ObjectID userID) {
		this.userID = userID;
	}

	public ObjectID getUserID() {
		return userID;
	}
	
}
